package com.uwo.commons.samples;

//import com.uwo.commons.apollo.configuration.ApolloListenter;
import com.uwo.commons.configuration.EnableValidate;
import com.uwo.commons.configuration.aop.validate.excepteion.CommonResponse;
//import com.uwo.commons.apollo.configuration.RedisProperties;
import com.uwo.commons.dubbo.configuration.EnableDubbo;
import com.uwo.commons.redis.configuration.EnableRedis;
import com.uwo.commons.samples.response.UwoResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * spring boot启动类
 * @author hao.yan
 */
//@EnableApollo
@EnableDubbo
// 引入校验工具
@EnableValidate
@EnableRedis
//@EnableEurekaClient
@Configuration
@SpringBootApplication
public class SamplesApplication {

    private final Logger log = LoggerFactory.getLogger(SamplesApplication.class);

    @Bean
    public CommonResponse commonResponse(){
        return new UwoResponse();
    }

    @Autowired
    private SpringApplicationBeanUtil springApplicationBeanUtil;

    /**
     * 注入ApplicationContext
     * @return
     */
    @Bean
    public ApplicationContext getApplicationContext(){
        return springApplicationBeanUtil.getApplicationContext();
    }

    public static void main(String[] args){
        SpringApplication app = new SpringApplication(SamplesApplication.class);
//        app.addListeners(new ApolloListenter());
        app.run(args);
    }

}
